package cn.ithers.blog.service.impl;

import cn.ithers.blog.utils.Constants;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @Author: zhanghuan
 * @date: 2020/10/4 11:12
 * @description:
 */
@Service
public class BaseService {
    /**
     * 检查页码
     *
     * @param page
     * @return
     */
    public int checkPage(int page) {
        if (page < Constants.Page.DEFAULT_PAGE) {
            page = Constants.Page.DEFAULT_PAGE;
        }

        return page;
    }

    /**
     * 检查每页大小
     *
     * @param pageSize
     * @return
     */
    public int checkPageSize(int pageSize) {

        if (pageSize < Constants.Page.DEFAULT_PAGE) {
            pageSize = Constants.Page.DEFAULT_PAGE;
        }
        return pageSize;
    }
}

